#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Allow skipping this hook by setting SKIP_CHECK env variable
if [ ! -z "$SKIP_CHECK" ]; then
  exit 0
fi

while read local_ref local_sha remote_ref remote_sha
do
    if [ "$remote_ref" = "refs/heads/main" ]; then
        echo "Direct pushes to 'main' are not allowed. Please use a feature branch and a pull request."
        exit 1
    fi
done